import { getGameObjectById } from "../engine";
import { Behaviour } from "../engine/Behaviour";
import { BitmapWithClipRender } from "../engine/BitmapWithClipRender";
import { Transform } from "../engine/Transform";
import { number } from "../engine/validators/number";
import { ChangeScene } from "./ChangeScene";
import { dateStorageInUI } from "./dateStorageInUI";
import { Display } from "./Display";
import { Drag } from "./Drag";
import { LeftMouseClick } from "./LeftMouseClick";

export class mask extends Behaviour {
    putSauce = 0
    putVinegar = 0
    putSpicy = 0

    onStart() {
        
        this.gameObject.onClick = () => {
            //this.engine.scenenumber=3;
            console.log("test",this.engine.scenenumber)
            //getGameObjectById("eggSpread").getBehaviour(BitmapWithClipRender).clip.IsClear=true;
            //getGameObjectById("sauceSpread").getBehaviour(BitmapWithClipRender).clip.IsClear=true;
            //getGameObjectById('changeScene').getBehaviour(ChangeScene).LoadScene("scene2");

        };
    }

    onTick(duringTime: number) {
        if(getGameObjectById("shovelPut").getBehaviour(Drag).IsTouch){
            console.log("涂鸡蛋")
            //getGameObjectById("eggSpread").getBehaviour(BitmapWithClipRender).clip.IsClear=false;
            const clip = {x:getGameObjectById("shovelPut").getBehaviour(Drag).mousemove.x-getGameObjectById("skinPut").getBehaviour(Transform).x,
                          y:getGameObjectById("shovelPut").getBehaviour(Drag).mousemove.y-getGameObjectById("skinPut").getBehaviour(Transform).y,
                          width:100,
                          height:100  }
            getGameObjectById("eggSpread").getBehaviour(BitmapWithClipRender).clips.push(clip)

        }
        if(getGameObjectById("shuaziPut").getBehaviour(Drag).IsTouch){
            console.log("涂酱")
            const clip = {x:getGameObjectById("shuaziPut").getBehaviour(Drag).mousemove.x-getGameObjectById("skinPut").getBehaviour(Transform).x,
                          y:getGameObjectById("shuaziPut").getBehaviour(Drag).mousemove.y-getGameObjectById("skinPut").getBehaviour(Transform).y,
                          width:100,
                          height:100  }
            getGameObjectById("sauceSpread").getBehaviour(BitmapWithClipRender).clips.push(clip)
            //存放的原料--传给UI--与订单对比
            this.putSauce = 1
            getGameObjectById("dateStorage").getBehaviour(dateStorageInUI).putsauce =this.putSauce
        }
        if(getGameObjectById("vinegarshuaziPut").getBehaviour(Drag).IsTouch){
            console.log("涂醋")
            const clip = {x:getGameObjectById("vinegarshuaziPut").getBehaviour(Drag).mousemove.x-getGameObjectById("skinPut").getBehaviour(Transform).x,
                          y:getGameObjectById("vinegarshuaziPut").getBehaviour(Drag).mousemove.y-getGameObjectById("skinPut").getBehaviour(Transform).y,
                          width:100,
                          height:100  }
            getGameObjectById("vinegarSpread").getBehaviour(BitmapWithClipRender).clips.push(clip)
            //存放的原料--传给UI--与订单对比
            this.putVinegar = 1
            getGameObjectById("dateStorage").getBehaviour(dateStorageInUI).putvinegar =this.putVinegar
        }
        if(getGameObjectById("spicysauceshuaziPut").getBehaviour(Drag).IsTouch){
            console.log("涂辣酱")
            const clip = {x:getGameObjectById("spicysauceshuaziPut").getBehaviour(Drag).mousemove.x-getGameObjectById("skinPut").getBehaviour(Transform).x,
                          y:getGameObjectById("spicysauceshuaziPut").getBehaviour(Drag).mousemove.y-getGameObjectById("skinPut").getBehaviour(Transform).y,
                          width:100,
                          height:100  }
            getGameObjectById("spicysauceSpread").getBehaviour(BitmapWithClipRender).clips.push(clip)
            //存放的原料--传给UI--与订单对比
            this.putSpicy = 1
            getGameObjectById("dateStorage").getBehaviour(dateStorageInUI).putspicy =this.putSpicy
        }
        
    }
}